#pragma once

#include <iostream>
#include <string>
#include <unistd.h>
#include <functional>
#include <vector>
#include <map>

#define HandSize 4

typedef std::function<void()> func;
std::vector<func> callback;
std::map<int, std::string> des;

void ReadMySQL()
{
    std::cout << "process[" << getpid() << "] 执行访问数据库的任务" << std::endl;
}

void execuleUrl()
{
    std::cout << "process[" << getpid() << "] 执行解析url的任务" << std::endl;
}

void cal()
{
    std::cout << "process[" << getpid() << "] 执行加密的任务" << std::endl;
}

void safe()
{
    std::cout << "process[" << getpid() << "] 执行数据持久的任务" << std::endl;
}

void Init()
{
    des.insert(std::make_pair(callback.size(), "访问数据库"));
    callback.push_back(ReadMySQL);

    des.insert(std::make_pair(callback.size(), "解析url   "));
    callback.push_back(execuleUrl);

    des.insert(std::make_pair(callback.size(), "加密      "));
    callback.push_back(cal);
    
    des.insert(std::make_pair(callback.size(), "数据持久化"));
    callback.push_back(safe);
}